import { createBrowserRouter } from 'react-router-dom';
import Layout from '@/components/Layout';
import LoginPage from '@/pages/login';
// import Home from '@/pages/Home';
import { UserList, UserPermission, UserProfile, UserRegister } from '@/pages/user';
import { SupplierList, SupplierDetail, SupplierEvaluation } from '@/pages/supplier';
import { InventoryIn, InventoryOut, InventoryCheck,List } from '@/pages/inventory';
import { SalesOrder, SalesDelivery, SalesReport } from '@/pages/sales';
import { QualityInspection, ProductionMonitoring,QualityTrace,QualityInspectionList } from '@/pages/quality';
import { PurchaseReport, SalesAnalysis, InventoryReport } from '@/pages/reports';

const appRouter = createBrowserRouter([
  {
    path: '/login',
    element: <LoginPage />,
  },
  {
    path: '/',
    element: <Layout />,
    children: [
      {
        path: '/user',
        children: [
          {
            path: 'list',
            element: <UserList />
          },
          {
            path: 'permission',
            element: <UserPermission />
          },
          {
            path: 'profile',
            element: <UserProfile />
          },
          {
            path: 'register',
            element: <UserRegister />
          }
        ]
      },
      {
        path: '/supplier',
        children: [
          {
            path: 'list',
            element: <SupplierList />
          },
          {
            path: 'detail/:id',
            element: <SupplierDetail />
          },
          {
            path: 'evaluation',
            element: <SupplierEvaluation />
          }
        ]
      },
      {
        path: 'inventory',
        children: [
          {
            path: 'list',
            element: <List />
          },
          {
            path: 'in',
            element: <InventoryIn />
          },
          {
            path: 'out',
            element: <InventoryOut />
          },
          {
            path: 'check',
            element: <InventoryCheck />
          }
        ]
      },
      {
        path: 'sales',
        children: [
          {
            path: 'orders',
            element: <SalesOrder />
          },
          {
            path: 'delivery',
            element: <SalesDelivery />
          },
          {
            path: 'reports',
            element: <SalesReport />
          }
        ]
      },
      {
        path: 'quality',
        children: [
          {
            path:'list',
            element: <QualityInspectionList />
          },
          {
            path: 'inspection',
            element: <QualityInspection />
          },
          {
            path: 'monitoring',
            element: <ProductionMonitoring />
          },
          {
            path: 'trace',
            element: <QualityTrace />
          }
        ]
      },
      {
        path: 'reports',
        children: [
          {
            path: 'purchase',
            element: <PurchaseReport />
          },
          {
            path: 'sales',
            element: <SalesAnalysis />
          },
          {
            path: 'inventory',
            element: <InventoryReport />
          }
        ]
      }
    ]
  }
]);

export default appRouter;
